package com.seeTools.next.api.entity.sys;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.seeTools.next.api.entity.TenantBaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 系统用户信息表
 * </p>
 *
 * @author FallenDust
 * @since 2023-04-24
 */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@ExcelIgnoreUnannotated
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_user")
public class SysUser extends TenantBaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 登录名，不允许重复
     */
    private String loginName;

    /**
     * 用户名称
     */
    private String userName;

    /**
     * 登录密码
     */
    @JsonIgnore
    private String password;

    /**
     * 电话号码
     */
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 用户头像地址
     */
    private String avatar;

    /**
     * 性别
     */
    private String sex;

    /**
     * 用户状态
     */
    private Integer active;

    /**
     * 所属企业ID
     */
    private Long companyId;

    /**
     * 所属部门ID
     */
    private Long departmentId;

    /**
     * 所属岗位ID
     */
    private Long positionId;

    /**
     * 过期日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime expirationDate;

    /**
     * 最近登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime lastLoginTime;

    /**
     * 微信openid
     */
    private String wxOpenid;

    /**
     * 备注信息
     */
    private String remarks;

    /**
     * 登录tokenName
     */
    @TableField(exist = false)
    private String tokenName;

    /**
     * 登录tokenValue
     */
    @TableField(exist = false)
    private String tokenValue;

    /**
     * 角色列表
     */
    @TableField(exist = false)
    private List<SysRole> roles;

    /**
     * 角色ID列表
     */
    @TableField(exist = false)
    private List<Long> roleIdList;

    /**
     * 按钮权限列表
     */
    @TableField(exist = false)
    private List<String> authBtnList;

    /**
     * 租户名称
     */
    @TableField(exist = false)
    private String tenantName;
}
